package com.cq.service.Impl;

import com.cq.dao.DormDao;
import com.cq.pojo.Dorm;
import com.cq.service.DormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DormServiceImpl implements DormService{

    private DormDao dormDao;

    @Autowired
    public void setDormDao(DormDao dormDao) {
        this.dormDao = dormDao;
    }

    @Override
    public List<Dorm> queryAllDorms() {
        List<Dorm> dorms = dormDao.queryAllDorms();
        return dorms;
    }

    @Override
    public int addDorm(Dorm dorm) {
        int result = dormDao.addDorm(dorm);
        return result;
    }

    @Override
    public int updateDormById(Dorm dorm) {
        int result = dormDao.updateDormById(dorm);
        return result;
    }

    @Override
    public int deleteDormById(int id) {
        int result = dormDao.deleteDormById(id);
        return result;
    }

    @Override
    public Integer updateBuildDorm(Integer id) {
        return dormDao.updateBuildDorm(id);
    }

    @Override
    public Integer deleteBuildDorm(Integer id) {
        return dormDao.deleteBuildDorm(id);
    }
}
